<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>请假申请详情页面</title>
    <link rel="stylesheet" href="/workflow/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="/workflow/css/public.css" media="all">
</head>
<body>
<p id="username">${username}的请假申请详情页面</p>
<p id="days">请假天数：${days}天</p>
<p id="reason">请假原因：${reason}</p>
<p>这里假装是请假申请详情页面，里面可以显示各种请假相关的详细信息，对于其他的审批业务来说，可以展示与之相关的信息<p>
<p>该页面的存在场景是在审批的时候会嵌套显示到审批页面中，以便审批人员查看</p>
<p>如何与审批流关联了？查看该审批流，在每个节点属性最下面有个文档（元素文档），里面可以直接填写该页面的访问路径。如果路径中含有变量参数，可以在监听方法中指定业务内容访问路径</p>
<pre>
    @OnActivitiEvent(type = OnActivitiEvent.Type.TASK_CREATED,name = "人事审批")
    public void setmanager(TaskEvent taskEvent) {
        Leave leave = leaveService.get(taskEvent.getBusinessKey());
        taskEvent.getTaskEntity().setDescription(String.format("/demo/Leave.html?username=%s&days=%s&reason=%s", leave.getUsername(), leave.getDays(), leave.getReason()));
    }
</pre>
<script>
    const url = new URL(window.location.href);

    // 使用 URLSearchParams 获取查询参数
    const params = new URLSearchParams(url.search);

    // 获取参数值
    const username = params.get('username');
    const reason = params.get('reason');
    const days = params.get('days');
    document.getElementById('username').textContent  = document.getElementById('username').textContent.replace('${username}', username);
    document.getElementById('reason').textContent =document.getElementById('reason').textContent.replace('${reason}', reason);
    document.getElementById('days').textContent =document.getElementById('days').textContent.replace('${days}', days);
</script>
</body>
</html>